package com.demo2;

public class Demo2 {
    public static void main(String[] args) {
        //向上转型
        SportMan sport = new NbaPlayer();
        sport.running();

        NbaPlayer np1 = (NbaPlayer)sport;
        np1.jump();

        sport = new FootPlayer();

        sport.running();
        //此时sport引用内存的石footerPlayer,直接转换会报错
//        NbaPlayer np2 = (NbaPlayer)sport;

//        np2.running();
    }
}
